<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  * {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  #div1 {
    position: absolute;
    width: 80px;
    background: #CCC;
    border: 1px solid black;
    display: none;
  }
</style>
<script>
  window.onload = function () {

  }
  //鼠标右键
  document.oncontextmenu = function (event) {
    let div1 = document.getElementById("div1")
    div1.style.display = "block"
    div1.style.left = event.clientX + "px"
    div1.style.top = event.clientY + "px"
    //阻止默认事件
    return false
  }
  document.onclick = function(){
    let div1 = document.getElementById("div1")
    div1.style.display = "none"

  }

</script>

<body>

  <div id="div1">
    <ul>
      <li>aaa</li>
      <li>bbb</li>
      <li>ccc</li>
      <li>ddd</li>
    </ul>
  </div>

</body>

</html>